package com.deyang.mycommon.application;

import android.graphics.Typeface;

import com.deyang.mycommon.R;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;

import es.dmoral.toasty.Toasty;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;

/**
 * @author wangdyang
 * @createDate 2018/9/4 10:05
 * @desc application需要加载的
 */
public class ApplicationLoader {


    private MyApplication application;

    public ApplicationLoader(MyApplication application) {
        this.application = application;
    }

    /**
     * 初始化弹层提示
     */
    public void initToasty() {
        Toasty.Config.getInstance()
                .setErrorColor(application.getResources().getColor(R.color.toast_error))
                .setInfoColor(application.getResources().getColor(R.color.toast_info))
                .setSuccessColor(application.getResources().getColor(R.color.toast_success))
                .setWarningColor(application.getResources().getColor(R.color.toast_warning))
                .setTextColor(application.getResources().getColor(R.color.textColor_white))
                .tintIcon(true)
                .setToastTypeface(Typeface.DEFAULT)
                .setTextSize(12)
                .apply(); // required
    }

    /**
     * 初始化播放器
     */
    public void initGSY() {

        GSYVideoType.enableMediaCodec();
        GSYVideoType.enableMediaCodecTexture();

        GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL);
        GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL);

        GSYVideoType.setRenderType(GSYVideoType.SUFRACE);
        GSYVideoType.setRenderType(GSYVideoType.GLSURFACE);

        IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_SILENT);

        GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL);
    }



}
